#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
LL Kuai(LL ask, LL k) {
    LL ret = 1;
    while (k) {
        if (k&1) {
            ret = (ret*ask) % MOD;
        }
        k = (k>>1);
        ask = (ask*ask) % MOD;
    }
    return ret;
}
LL C(LL n, LL k) {
    LL ret = 1;
    if (k>n/2) k = n - k;
    for (int i=0; i<k; ++i) {
        ret = ((ret * (n-i) ) % MOD) * Kuai(i+1, MOD-2);
        ret = ret % MOD;
    }
    return ret;
}
int main(int argc, char** argv) {
    LL k, a,b,x,y;
    cin>>k>>a>>x>>b>>y;
    LL res = 0;
    for (int i=0; i<=x; ++i) {
        if ((k-a*i) % b == 0 && (k-a*i)/b <= y && (k-a*i)/b >= 0) {
            res = (res + C(x, i) * C(y, (k-a*i)/b) % MOD) % MOD;
        }
    }
    cout<<res<<endl;
    return 0;
}
